import { get, post } from '../api'

export function study(course_id, section_id, student_id) {
    return get('study', { course_id, section_id, student_id })
}
export function getNotifications(student_id) {
    return get('getNotifications', { student_id })
}
export function getEvaluateCourse(student_id) {
    return get('getEvaluableCourse', { student_id })
}
/**
 * @description 学员上传评价数据
 * @param {string} student_id 学员ID
 * @param {string} course_id 课程ID
 * @param {Array} data Reviews的数据
 * @returns {Promise} 
 * @example uploadReviews("001","xxx",[1,2,3])
 */
export function uploadReviews(student_id, course_id, data) {
    return post('uploadReviews', { student_id, course_id, data })
}
/**
 * 
 * @param {boolean} watched 是否观看结束 必须
 * @param {number} currentTime 截止用户离开界面播放器的时长
 * @param {Array} resourceWatched 资源观看是否完成的数组
 * @returns 
 */
export function uploadStudyResult(course_id, section_id, student_id, watched, currentTime, resourceWatched) {
    return post('uploadStudyResult', { course_id, section_id, student_id, watched, currentTime, resourceWatched })
}
export function uploadExamResult(exam_id, student_id, topicSheet, subjectTopicStartIndex) {
    return post('uploadExamResult', { exam_id, student_id, topicSheet, subjectTopicStartIndex })
}
export function uploadTestResult(course_id, section_id, student_id, topicSheet, subjectTopicStartIndex) {
    return post('uploadExamResult', { course_id, section_id, student_id, topicSheet, subjectTopicStartIndex })
}

export function getExamTopics(exam_id, student_id) {
    return get('exam', { exam_id, student_id })
}

export function getTestTopics(course_id, section_id, student_id) {
    return get('study', { course_id, section_id, student_id })
}